﻿using System;
using System.Net;

namespace Airport
{
    public class Plane
    {

        private int _planeId;
        private string _tailNumber;
        private int _heading;
        private int _airspeed;
        private int _groundSpeed;
        private int _altitude;
        private int _bufferZone;
        private PlaneType _planeType;
        private Route _route;
        private Node _location;
        private PlaneStatus _planeStatus;

        public Plane()
            : this(-1, "", -1, -1, -1, -1, -1, null, null, null, PlaneStatus.UNINITIALIZED)
        {
        }

        public Plane(int inPlaneId, string inTailNumber, int inHeading, int inAirspeed, int inGroundSpeed, int inAltitude, int inBufferZone,
            PlaneType inPlaneType, Route inRoute, Node inLocation, PlaneStatus inPlaneStatus)
        {
            _planeId = inPlaneId;
            _tailNumber = inTailNumber;
            _heading = inHeading;
            _airspeed = inAirspeed;
            _groundSpeed = inGroundSpeed;
            _altitude = inAltitude;
            _bufferZone = inBufferZone;
            _planeType = inPlaneType;
            _route = inRoute;
            _location = inLocation;
            _planeStatus = inPlaneStatus;
        }

        public int planeId
        {
            get
            {
                return _planeId;
            }

            set
            {
                if (_planeId != value)
                {
                    _planeId = value;
                }
            }
        }

        public string tailNumber
        {
            get
            {
                return _tailNumber;
            }

            set
            {
                if (_tailNumber != value)
                {
                    _tailNumber = value;
                }
            }
        }

        public int heading
        {
            get
            {
                return _heading;
            }

            set
            {
                if (_heading != value)
                {
                    _heading = value;
                }
            }
        }

        public int airspeed
        {
            get
            {
                return _airspeed;
            }

            set
            {
                if (_airspeed != value)
                {
                    _airspeed = value;
                }
            }
        }

        public int groundSpeed
        {
            get
            {
                return _groundSpeed;
            }

            set
            {
                if (_groundSpeed != value)
                {
                    _groundSpeed = value;
                }
            }
        }

        public int altitude
        {
            get
            {
                return _altitude;
            }

            set
            {
                if (_altitude != value)
                {
                    _altitude = value;
                }
            }
        }

        public int bufferZone
        {
            get
            {
                return _bufferZone;
            }

            set
            {
                if (_bufferZone != value)
                {
                    _bufferZone = value;
                }
            }
        }

        public PlaneType planeType
        {
            get
            {
                return _planeType;
            }

            set
            {
                if (_planeType != value)
                {
                    _planeType = value;
                }
            }
        }

        public Route route
        {
            get
            {
                return _route;
            }

            set
            {
                if (_route != value)
                {
                    _route = value;
                }
            }
        }

        public Node location
        {
            get
            {
                return _location;
            }

            set
            {
                if (_location != value)
                {
                    _location = value;
                }
            }
        }

        // This may be unneccessary
        public enum PlaneStatus
        {
            UNINITIALIZED,
            HOLDING,
            TAXIING,
            CLEARED_FOR_TAKEOFF,
            CLEARED_FOR_LANDING,
            TOWING,
            LINED_UP_AND_WAITING,
            STOPPED,
            CRASHED,
            CLEARED_TO_CROSS_RUNWAY
        }

        public PlaneStatus planeStatus
        {
            get
            {
                return _planeStatus;
            }

            set
            {
                if (_planeStatus != value)
                {
                    _planeStatus = value;
                }
            }
        }

        
    }
}
